package univers;

import univers.Domaine.Obstacle.TypeObstacle;
import static univers.Domaine.*;

class Collision {

    Avatar A;
    boolean bord;
    boolean obstacle;

    Collision(Avatar A) {
        this.A = A;
        this.bord = false;
        this.obstacle = false;
    }

    boolean testObstacle() {
        if (horsDomaine()) {
            return true;
        }
        return Obstacle();

    }

    private boolean horsDomaine() {
        return (A.position.X < minX) | (A.position.X > maxX) | (A.position.Y < minY) | (A.position.Y > maxY);

    }

    private boolean Obstacle() {
        TypeObstacle[][] liste = A.domaine.obstacle.getListe();
        TypeObstacle E;
        if (((E = liste[A.position.X][A.position.Y]) != null)) {
            if (E.Etat == true) {
                return true;
            }
        }

        return false;

    }
}
